package com.dreamlin.gankio.mvvm.home.other

import androidx.recyclerview.widget.DiffUtil
import com.dreamlin.gankio.mvvm.home.GankEntity

/**
 * <p> Title: GankItemCallback </p>
 * <p> Description: </p>
 * @author:  dreamlin
 * @date:    10/1/20
 * @version: V1.0.0
 * Created by dreamlin on 10/1/20.
 */
class GankItemCallback : DiffUtil.ItemCallback<GankEntity>() {
    override fun areItemsTheSame(oldItem: GankEntity, newItem: GankEntity): Boolean {
        return oldItem.id == newItem.id
    }

    override fun areContentsTheSame(oldItem: GankEntity, newItem: GankEntity): Boolean {
        return oldItem.author == newItem.author &&
                oldItem.category == newItem.category &&
                oldItem.likeCounts == newItem.likeCounts &&
                oldItem.views == newItem.views &&
                oldItem.stars == newItem.stars &&
                oldItem.type == newItem.type &&
                oldItem.title == newItem.title &&
                oldItem.url == newItem.url &&
                oldItem.images.size == newItem.images.size
    }
}